﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VirtualPress.Infrastructure.Entities.Entity;

namespace VirtualPress.Portal.Biz
{
    public class KitBiz
    {

        #region Diary
        public static Diary GetOne(int id)
        {
            return new Diary().Find(c => c.Id == id);
        }
        public static List<Diary> ListOfDiary(string username, int page = 0, int pagesize = 4)
        {
            return new Diary().FindSomething(c => c.UserName == username,
                c => c.Id,
                page, pagesize);
        }

        public static Diary NewDiary(Diary diary)
        {
            return diary.PostAdd();
        }

        public static Diary DeleteDiary(int id)
        {
            var item = new Diary().Find(c => c.Id == id);
            if (item != null)
            {
                return item.PostModify();
            }
            return null;
        }
        #endregion

    }
}
